<template>
  <el-dialog :title="$t('table.detail')" width="500px" :visible="true" @close="onClose">
    <el-form :model="form" ref="dialog-form" label-width="50px" size="small">
      <el-form-item :label="$t('org.name')">
        <el-input :value="form.name" readonly></el-input>
      </el-form-item>
      <el-form-item :label="$t('org.address')">
        <el-input :value="form.fullAddress" readonly></el-input>
      </el-form-item>
      <el-form-item :label="$t('org.parent')">
        <el-input :value="form.parent | parentFormatter" readonly></el-input>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      var form = Object.assign({}, this.$parent.selectedRow);
      return {
        form: form
      };
    },
    methods: {
      onClose(){
        this.$router.push("/");
      }
    },
    filters: {
      parentFormatter(val){
        if(val){
          return val.name;
        }
        return '';
      }
    }
  };
</script>
